package data.vectors.implementation;

import data.vectors.*;




/**
 * This class implements an iterator over a vector using the getValue function of the associated vector
 */

public class BasicDoubleVectorIterator implements DoubleVectorIterator {
	
	/**
	 * The position of the iterator
	 */
	private int current_position;
	
	/**
	 * The double vector
	 */
	private DoubleVector vector;
	
	/**
	 * Build the iterator over a double vector
	 * @param v
	 */
	public BasicDoubleVectorIterator(DoubleVector v)
	{
		this.vector=v;
		current_position=-1;
	}
	
	public int getCurrentFeature() {
		return current_position;
	}

	public double getCurrentValue() {
		return vector.getValue(current_position);
	}

	public boolean hasNext() {
		return(current_position<vector.size()-1);
	}

	public void next() {
		current_position++;
	}

	public void close() {
	}

	public boolean getAlive() {
		return true;
	}
}
